  <div class="page-content">
<div class="container">
    <div class="col-sm-12">
        <{:Widget( 'BoxSns/Index/groupInfo',array( 'id'=>$group_id))}>
    </div>
    <div class="col-sm-8"  data-type="validate">
        <h1 class="main-title">发布新帖子</h1>
        <form class="form-horizontal" method="post" id="add_topic"  action="/BoxSns/Home/Index/addTopic"  data-type="ajaxSubmit">
            <input type="hidden" name="type" value="eduGroup">
            <input type="hidden"  name="id" value="<{$data.id}>">
            <input type="hidden"  name="pid" value="<{$group_id}>">
            <div class="form-group">
                <div for="input-title" class="col-sm-2 control-label">标题</div>
                <div class="col-sm-10">
                    <input type="text" required maxlength="200" class="form-control" id="title" name="title" value="<{$data['title']}>" autocomplete="off">
                </div>
            </div>
            <div class="form-group">
                <div for="input-title" class="col-sm-2 control-label">类别</div>
                <div class="col-sm-10">
                    <select  name="cate_id" class="form-control">
                        <volist name="cateList" id="vo">
                            <option value="<{$vo.cate_id}>">
                                <{$vo['cate_name']}>
                            </option>
                        </volist>
                    </select>
                </div>
            </div>
           
            <div class="form-group">
                <div for="input-title" class="col-sm-2 control-label">内容</div>
                <div class="col-sm-10">
                    <textarea w="100%" data-type="kindeditor" h="300px" style="width:100%" name="content"><{$data.content}></textarea>
                </div>
            </div>

             <div class="form-group">
                <!-- <div for="input-title" class="col-sm-2 control-label"> </div> -->
                <div class="col-sm-12" align="center">
                     <button type="submit"  class="btn btn-black  border-radius-none " style="width:100%" >发布</button>
                </div>
            </div>

        </form>
        
<script type="text/javascript">
$(document).on("validateReady",function(){
            $("#add_topic").bootstrapValidator({
                 message: '您填入的值不合法',
                 fields: {
                        title: {
                            message: '标题',
                            validators: {
                                notEmpty: {
                                    message: '标题不能为空',
                                },
                            }
                        }
             }
            }).on('success.form.bv',function(e){
                var bnt=$(this).find("[type='submit']");
                bnt.attr("click","return false");
                bnt.text("提交中...");
                $(this).attr("disabled","disabled");
            });
  });
$(function(){
  $("#add_topic").on("ajaxSubmitSuccess",function(e,content){
                var data =JSON.parse(content);
                console.log(data);
                $(this).text("发布");
                $(this).removeAttr("click");
                $(this).removeAttr("disabled");
                if(data.error==0){
                    hiApp.jump("/Group/det/id/<{$group_id}>");
                }else{
                    hiApp.alert(data.msg);
                }
        })  
})
        
</script>
    </div>
    <div class="col-sm-4">
           <{:Widget('BoxSns/Index/groupLists',array('type'=>'eduGroup'))}> 
    </div>
</div>
</div>